<extend name="Layout/ins_popup" />
<block name="content">	
	{:W('PageHeader/popup',array('name'=>'编辑'))}
	<div class="row" >
		<div class="col-sm-12">
			<form id="form_data" name="form_data" method="post" class="well form-horizontal clearfix" action="{:U('updateCarById')}">
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="carNum">汽车编号*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="carId" name="id" value="{$carInfo.id}" readOnly="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="carNum">车牌号*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="carNum" name="carNum" value="{$carInfo.carnum}" check="require" msg="请输入车牌号">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="carType">车型*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="carType" name="carType" value="{$carInfo.cartype}" check="require" msg="请输入车型">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="EngineNum">发动机号*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="EngineNum" name="EngineNum" check="require" value="{$carInfo.enginenum}" msg="请输入发动机号">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="DipanNum">底盘号码*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="DipanNum" name="DipanNum" check="require"  value="{$carInfo.dipannum}" msg="请底盘号码">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="oilCardNum">油卡号*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="oilCardNum" name="oilCardNum" check="require"  value="{$carInfo.oilcardnum}" msg="请输入油卡号">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="oilUse">油耗*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="oilUse" name="oilUse" check="require"  value="{$carInfo.oiluse}" msg="请输入油耗">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="insurer">保险公司*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="insurer" name="insurer" check="require"  value="{$carInfo.insurer}" msg="请输入保险公司">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="insurePhone">保险电话*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="insurePhone" name="insurePhone" check="require"  value="{$carInfo.insurephone}" msg="请输入保险电话">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="price">购买价格*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="price" name="price" check="require"  value="{$carInfo.price}" msg="请输入购买价格">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="color">车身颜色*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="color" name="color" check="require"  value="{$carInfo.color}" msg="请输入车身颜色">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="make">生产厂商*：</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" id="make" name="make" check="require" value="{$carInfo.make}" msg="请输入生产厂商">
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-sm-3 control-label" for="chuchangDate">出厂日期*：</label>
                    <div class="col-sm-9">
                        <div class="input-daterange input-group">
                            <input class="input-sm form-control text-center"  value="{$carInfo.chuchangdate}" readonly="readonly" type="text" id="chuchangDate" name="chuchangDate" check="require" msg="请输入出厂日期">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" for="struct">结构特点：</label>
                    <div class="col-sm-9">
                        <select class="form-control"  name="struct" id="struct" >
                            <if condition="$carInfo.struct eq '1'">
                                    <option  value="0" >手动</option>
                                    <option value="1" selected="selected">自动</option>
                                <else/>
                                    <option  value="0" selected="selected">手动</option>
                                    <option value="1" >自动</option>
                            </if>

                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label" for="state">状态：</label>
                    <div class="col-sm-9">
                        <select class="form-control"  name="state" id="state" >
                            <if condition="$carInfo.state eq '0'">
                                <option  value="0" selected="selected" >正常</option>
                                <option value="1" >维修</option>
                                <option value="2" >使用</option>
                            <elseif condition="$carInfo.state eq '1'"/>
                                <option  value="0" >正常</option>
                                <option value="1"  selected="selected" >维修</option>
                                <option value="2" >使用</option>
                            <else/>
                                <option  value="0" >正常</option>
                                <option value="1"   >维修</option>
                                <option value="2"  selected="selected">使用</option>
                            </if>

                        </select>
                    </div>
                </div>

                <div class="form-group ">
                    <label class="col-sm-3 control-label" for="motDate">年检日期*：</label>
                    <div class="col-sm-9">
                        <div class="input-daterange input-group">
                            <input class="input-sm form-control text-center" value="{$carInfo.motdate}  readonly="readonly" type="text" id="motDate" name="motDate" check="require" msg="请输入年检日期">
                        </div>
                    </div>
                </div>
			</form>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
        var varsOrigin = $("#form_data").serialize();
        function save(){
            if (check_form("form_data")) {
                var vars = $("#form_data").serialize();
                if(varsOrigin != vars){
                    sendAjax("{:U('updateCarById')}", vars, function(data) {
                        if (data.status) {
                            ui_alert(data.info, function() {
                                parent.location.reload(true);
                                myclose();
                            });
                        }else{
                            ui_error(data.info);
                        }
                    });
                }else{
                    ui_error("未修改任何数据项");
                }

            }
        }



	</script>
</block>